package com.classactionpl.jaas.activemq;

import java.util.Set;

import org.apache.activemq.broker.Broker;
import org.apache.activemq.security.JaasCertificateAuthenticationPlugin;

/**
 * 
 * A JAAS based SSL certificate authentication plugin for just where SSL
 * transports are used.
 * 
 * @author huntc
 * 
 * @org.apache.xbean.XBean description=
 *                         "Provides a JAAS based SSL certificate authentication plugin for SSL transports"
 * 
 */
public class SslCertificateAuthenticationPlugin extends
		JaasCertificateAuthenticationPlugin {
	String nonsslUsername;
	Set<String> nonsslGroups;

	public Set<String> getNonsslGroups() {
		return nonsslGroups;
	}

	public String getNonsslUsername() {
		return nonsslUsername;
	}

	@Override
	public Broker installPlugin(Broker broker) {
		initialiseJaas();
		return new SslCertificateAuthenticationBroker(broker, configuration,
				nonsslUsername, nonsslGroups);
	}

	public void setNonsslGroups(Set<String> nonsslGroups) {
		this.nonsslGroups = nonsslGroups;
	}

	public void setNonsslUsername(String nonsslUsername) {
		this.nonsslUsername = nonsslUsername;
	}

}
